package com.learn.action;

import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.learn.util.utils;

@Controller
@RequestMapping("/index")
public class IndexControlle {

	
	@RequestMapping(value="/weixin",method=RequestMethod.GET,produces="text/html;charset=UTF-8")
	@ResponseBody
	public String initWeixinURL(HttpServletRequest request){
		
		String echostr = request.getParameter("echostr");
		if(utils.checkWeixinReques(request) && echostr != null){
			return echostr;
		}else{
			return "error";
		}
		
	}

}
